\documentclass{ctexart}
\usepackage{listings}%插入代码
\usepackage{geometry}%设置页面大小边距等
\usepackage{graphicx}%插入图片
\usepackage{amssymb}%为了用\mathbb
\usepackage{amsmath}%数学方程的显示
\usepackage{listings}%插入代码
\usepackage{fancyhdr}%设置页眉页脚
\usepackage{lastpage}%总页数
\usepackage{hyperref}%引用网页
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{float}
\usepackage{subcaption}


\geometry{a4paper,left=2cm,right=2cm,top=2cm,bottom=2cm}%一定要放在前面！
\pagestyle{fancy}%设置页眉页脚
\lhead{陈冠宇\ 3200102033}%页眉左
\chead{Object-Oriented Programming}%页眉中
\rhead{Project2}%章节信息
\cfoot{\thepage/\pageref{LastPage}}%当前页，记得调用前文提到的宏包
\lfoot{Zhejiang University}
\rfoot{School of Mathematical Sciences}
\renewcommand{\headrulewidth}{0.1mm}%页眉线宽，设为0可以去页眉线
\renewcommand{\footrulewidth}{0.1mm}%页脚线宽，设为0可以去页眉线
\setlength{\headwidth}{\textwidth}

\hypersetup{%设置网页链接颜色等
    colorlinks=true,%链接将会有颜色，默认是红色
    linkcolor=blue,%内部链接，那些由交叉引用生成的链接将会变为蓝色（blue）
    filecolor=magenta,%链接到本地文件的链接将会变为洋红色（magenta）
    urlcolor=blue,%链接到网站的链接将会变为蓝绿色（cyan）
    }

\newtheorem{theorem}{Theorem}
\newtheorem{proof}{Proof}
\newtheorem{solution}{Solution:}

\title{\textbf{Object-Oriented Programming}}
\date{\today}

\begin{document}
\subsection*{Introduction}
This program tells  a story.

Once upon a time, a princess was prisoned in a dismal castle by an evil dragon. Then you, a fearless warrior,  need to save the princess!

There are five kinds of rooms in the castle, with a lobby where you are in the beginning, a cell where the princess was prisoned, several empty rooms, in one of which the key to the cell is hidden, and monster room where the evil dragon is living. The player should avoid the dragon, or you would be killed cruelly. Also, you need to get the key, and then save the princess and eventually take her away safely. The exit room is also the lobby. The birth palace is randomly decided, same as the cell, monster room and the key.

Players should input "go -", like "go east/west/up/down", to control the warrior's motivation. Once you enter a room, you will be informed about the room, like whether you meet the princess or the dragon. In addition, you can see your current position(*) by a map which will be printed out every time you enter a new room. Most importantly,  if the monster is around you, you will get warning to be careful.

Let's save the princess! Good luck!
\subsection*{How to run}
    g++ -o test main.cpp

    ./test

    Then you should input a number n$(n\times n$ Matrix Castle), and some other orders according to tips.
\subsection*{Result}
The $10\times 10$ matrix castle is like:
\begin{lstlisting}
 0       0       0       0       0       0       0       0       0       0
 0      | |     | |     | |     | |     | |     | |     | |     | |      0
 0      | |     | |     | |     | |     | |     | |     | |     | |      0
 0      | |     |*|     | |     | |     | |     | |     | |     | |      0
 0      | |     | |     | |     | |     | |     | |     | |     | |      0
 0      | |     | |     | |     | |     | |     | |     | |     | |      0
 0      | |     | |     | |     | |     | |     | |     | |     | |      0
 0      | |     | |     | |     | |     | |     | |     | |     | |      0
 0      | |     | |     | |     | |     | |     | |     | |     | |      0
 0       0       0       0       0       0       0       0       0       0
\end{lstlisting}
For convenience, we choose $7\times 7$ matrix castle.
\subsubsection*{Birth Place(lobby):}
You need to save the prisoned princess! Let's go Warrior! Welcome to the lobby. There are 3 exits: east, west and up. Type listen to check around...

Enter your command:

------------------------------------------------
\subsubsection*{Empty room}
\begin{lstlisting}
You are here:
 0       0       0       0       0       0       0
 0      | |     | |     | |     | |     | |      0
 0      | |     | |     |*|     | |     | |      0
 0      | |     | |     | |     | |     | |      0
 0      | |     | |     | |     | |     | |      0
 0      | |     | |     | |     | |     | |      0
 0       0       0       0       0       0       0
 \end{lstlisting}
(if the monster is around you)Dong...Dong...Dong...Some heavy sound of footsteps with raspy growl...Be careful!

There is nothing here. Enter your command:

------------------------------------------------

Similarly the cell and monster. Only when you come with the princess with the key, can you save the princess. The dialogue vary from conditions. If you come up with the monster, you will be dead and game over. In addition, only when you have already save the princess can  you escape the castle.

\subsubsection*{Victory:}
Victory! Congratulation!
\subsubsection*{Defeat:}
There is an evil dragon lurked in the shadows. You are spotted by the dragon. It reared up on its hind legs and lashed out at you with its razor-sharp claws.

The dragon struck a fatal blow, you fell to the ground, dead...

------------------------------------------------

Game Over...
\subsection*{Conclusion}
This game is like a trivial Mines-weeping game. You need to remember the room you have walked through and deduce the monster's position.
\end{document} 